<!doctype html>
<html>
<head>
    <script src="jquery/jquery.js"></script>
    <link href="css/css.css" rel="stylesheet" type="text/css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="format-detection" content="telephone=no" />
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <meta charset="utf-8">
    <title>无标题文档</title>
    <style>
        /*我的钱包*/
        .problem{ height:46px; padding-left:4%; padding-right:4%; position:relative; background-color:#fff;}
        .problem h1{ float:left; line-height:46px; color:#65646b;}
        .problem span{ position:absolute; right:4%; top:13px; margin-right:20px; color:#E90000;}
        .pay h3{ line-height:42px; padding-left:4%; color:#65646b}
    </style>
    <script src="/jquery/jquery.js"></script>
    <script src="/layui/layui.js"></script>
</head>

<body style="background-color: #f9f9f9;">
<!--header顶部标题-->
<div class="header">充值
    <div class="header_left" onClick="window.history.go(-1)"><img src="images/return.png"></div>
</div>
<!--账户-余额-金额-->
<div class="problem" style=" margin-top:16px;">
    <h1>充值账户</h1>
    @if ($res->account!=null)
    <div class="next">{{$res->account}}</div>
    <div class="border_bottom" style=" left:4%; width:96%"></div>
    <div class="border_top"></div>
    @else
    <div class="next">请先注册好嘛</div>
    <div class="border_bottom" style=" left:4%; width:96%"></div>
    <div class="border_top"></div>
    @endif
</div>
<form action="" method="post" id="form">
    {{csrf_field()}}
<div class="problem" >
    <h1>充值金额</h1>
    <div class="next"><span>￥<input type="text" name="recharge" value="0"></span></div>
　　<input  type="hidden" name="_token" value="{{ csrf_token() }}" />
    <div class="border_bottom" style=" left:4%; width:96%"></div>
</div>
<!-------付费方式------->
<div class="pay">
    <h3>付费方式</h3>
    <div class="problem">
        <h1>微信支付</h1>
        <div class="next"><input type="radio" name="radio"></div>
        <div class="border_bottom" style=" left:4%; width:96%"></div>
        <div class="border_top"></div>
    </div>
    <div class="problem" >
        <h1>银联支付</h1>
        <div class="next"><input type="radio" name="radio"></div>
        <div class="border_bottom"></div>
    </div>
</div>
<!--提交-->
<div class="confirm_box">
    <div class="confirm" style=" background:#01AEF0"><input type="submit" value="确认支付" style=" background:#01AEF0" id="submit"></div>
</div>
</form>
</body>
</html>
    <script>
        $(function(){
            $('#submit').click(function () {
                $.ajaxSetup({
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                     }
                });
                var form = $('#form').serialize();
                $.get({
                    url:"memberadd",
                    data: form,
                    success:function (data) {
                        layui.use('layer', function(){
                            var layer = layui.layer;
                            if(data.code=='2') {
                                layer.open({
                                    title: '充值'
                                    , skin: 'msg'
                                    , content: data.name
                                    , yes: function () {
                                        location.href = '/';
                                }
                             });
                            }else if(data.code=='1'){
                                layer.open({
                                    title: '充值'
                                    , skin: 'msg'
                                    , content: data.name
                                    , yes: function () {
                                        location.href = data.url;
                                    }
                                });

                            }
                        });
                    }
                });
                return false;
            });
        });
    </script>
